/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sequence;

import rule.Rule;
import score.Score;

/**
 *
 * @author Daniel Gribel
 */
public class Sequence extends Rule {
    
    private String sequence;
    
    public Sequence(Score score, String sequence, String name) {
        super(score, name);
        this.sequence = sequence;
    }
    
    @Override
    public void checkConditions(String data) {
        setCounter(0);
        for (int s = 0; s < sequence.length()-3; s++) {
            String sFwd = sequence.substring(s, s + 3);
            String sRev = new StringBuffer(sFwd).reverse().toString();
            if (data.toLowerCase().indexOf(sFwd) != -1 || data.toLowerCase().indexOf(sRev) != -1) {
                setCounter(getCounter() - 1);
            }
        }
    }

    @Override
    public void checkClauses(char character) {
        
    }
}

